package utilitarios;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class SelecionarDados {

    public static void main(String args[]) throws SQLException {
        //ConexaoDao conecta = new ConexaoDao();
        //conecta.getConnection();
        
         String sql ="select * from cadastro";
         String url = "jdbc:mysql://localhost:3306/aula";
         String login = "root";
         String senha = "charlesjava123";
         
         Connection con = DriverManager.getConnection(url, login,senha);
         try
         (PreparedStatement stm = con.prepareStatement(sql)){
             
             ResultSet rs = stm.executeQuery();
             while(rs.next()){
                 System.out.println("Nome: "+rs.getString(1)+" -> E-mail: "+rs.getString(2));
             }
             stm.executeBatch();
        // stm.executeUpdate();
         }
    
    }
}